﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace FileApps
{
    /// <summary>
    /// Currently not in use. This will be a feature in a new version.
    /// </summary>
    public static class FindCodeFiles
    {
        private static List<FileInfo> _codeFiles = new List<FileInfo>();
        
        //default extention
        private static string extention = ".cs";

        public static List<FileInfo> GetFiles(string path)
        {
            GetFilesRecursively(path);
            return _codeFiles;
        }

        private static void GetFilesRecursively(string path)
        {
            var files = Directory.GetFiles(path);
            foreach (var file in files)
            {
                FileInfo fi = new FileInfo(file);
                if (fi.Extension == extention)
                {
                    _codeFiles.Add(fi);
                }
            }

            var directories = Directory.GetDirectories(path);
            foreach (var dir in directories)
            {
                GetFilesRecursively(dir);
            }

            
        }
    }
}
